<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('审核商户信息')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-shop-examine" th:object="${optShop}">
        <input name="shopid" th:field="*{shopId}" type="hidden">
        <input name="deptId" type="hidden" id="treeId"/>

        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>审核状态：</label>
            <div class="col-sm-8">
                <select name="examineStatus" class="form-control m-b"
                        th:with="type=${@dict.getType('t_examine_status')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:field="*{examineStatus}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">审核描述：</label>
            <div class="col-sm-8">
                <input name="examineDesc" class="form-control" type="text" th:field="*{examineDesc}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">所属部门：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input name="deptName" readonly="readonly" onclick="selectDeptTree()" th:field="*{deptName}"
                           id="treeName" type="text" placeholder="请选择归属部门" class="form-control">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    var prefix = ctx + "operator/shop"
    $("#form-shop-examine").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/examine", $('#form-shop-examine').serialize());
        }
    }

    /*用户管理-新增-选择部门树*/
    function selectDeptTree() {
        var treeId = $("#treeId").val();
        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        if ($.tree.notAllowParents(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }
</script>
</body>
</html>